package com.dcyao.musicserve.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.dcyao.musicserve.domain.Consumer;
import com.dcyao.musicserve.domain.dto.ConsumerDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;


/**
* @author admin
* @description 针对表【consumer(前端注册用户)】的数据库操作Mapper
* @Entity com.xs.domain.Consumer
*/
@Mapper
public interface ConsumerMapper extends BaseMapper<Consumer> {
    /**
     * 查询用户总数
     * @return
     */
    @Select("SELECT COUNT(id) FROM consumer")
    int consumerCount();

    /**
     * 查询需要审批的用户
     * @return
     */
    @Select("SELECT consumer.*,staff.type,staff.file,staff.name,staff.introduction as intro,staff.id as staffId  FROM consumer JOIN staff on consumer.id=staff.consumer_id WHERE staff.type=2 ")
    Page<ConsumerDTO> needConsumerType(Page<ConsumerDTO> page);

}
